
module.exports = {
  getAllVehicles,refreshVehicles,getVehicleNum,clear
}
// 本接口用于缓存车辆信息
const SERVER = require("./interface")
let vehicles = []

async function refreshVehicles(){
  let result = await SERVER.queryVehicle()
  if(result.status=="success")
  {
    vehicles = result.res
    return true
  }
  else{
    return false
  }
}

function getAllVehicles(){
  return vehicles
}

function getVehicleNum(){
  return vehicles.length
}

function clear(){
  vehicles = []
}